//
//  BKViewController.m
//  BKKit
//
//  Created by baboy on 02/13/2019.
//  Copyright (c) 2019 baboy. All rights reserved.
//

#import "ViewController.h"
#import "DBCache.h"
#import "BKHttpRequestManager.h"
#import "Api.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    [DBCache setValue:[NSDate date] forKey:@"key1"];
//    [[BKHttpRequestManager defaultManager] getJSON:@"http://api.rong.xindaibang.net/app_lm/appdata/json/cofig.json"
//                                       parameters:nil success:^(id  _Nonnull task, id  _Nullable json) {
//                                           NSLog(@"json:%@",json);
//
//                                       } failure:^(id  _Nullable task, id  _Nullable json, NSError * _Nonnull error) {
//                                           NSLog(@"error:%@",error);
//
//                                       }];
    [[BKHttpRequestManager defaultManager] POST:@"https://api.weixin.qq.com/sns/jscode2session"
                                     parameters:nil
                                   responseType:BKHttpResponseTypeJSON
                                        success:^(id  _Nonnull task, id  _Nullable responseObject) {
                                            NSLog(@"json:%@", responseObject);
                                        }
                                        failure:^(id  _Nonnull task, NSError * _Nonnull error) {
                                            NSLog(@"error:%@",error);
                                        }];
    [Api request:@"query_conf"
      parameters:nil
         success:^(id  _Nonnull task, id  _Nullable json) {
             NSLog(@"json:%@", json);
         }
         failure:^(id  _Nullable task, id  _Nullable json, NSError * _Nonnull error) {
             NSLog(@"error:%@",error);
         }];
    [Api request:@"query_conf2"
      parameters:nil
         success:^(id  _Nonnull task, id  _Nullable json) {
             NSLog(@"json:%@", json);
         }
         failure:^(id  _Nullable task, id  _Nullable json, NSError * _Nonnull error) {
             NSLog(@"error:%@",error);
         }];
    [Api checkVersionSuccess:^(id  _Nonnull task, id  _Nullable json) {
        NSLog(@"error:%@",json);
    }
                     failure:^(id  _Nullable task, id  _Nullable json, NSError * _Nonnull error) {
                         NSLog(@"error:%@",error);
                     }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
